import { ApplicationController } from "../support/application-controller"
import axios from 'axios'

export default class extends ApplicationController {
  static targets = [ "say" ]

  initialize() {
    console.log("init...")
  }

  inputSay () {
    if (event.keyCode == 13) {
      if (this.sayTarget.value.length > 0) {
        console.log("say...")
        document.getElementById("sayForm").submit()
      } else {
        alert('不能为空.')
      }
    }
  }

  saySubmit () {
    if (this.sayTarget.value.length > 0) {
      console.log("say...")
      document.getElementById("sayForm").submit()
    } else {
      alert('不能为空.')
    }
  }

  get say() {
    return this.sayTarget.value
  }
}